From f976214e1d01dba4af4fc5b5e89c3b2bd329eb10 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 20 Mar 2009 15:37:33 +0000 Subject: [PATCH] pygrub: run first entry in config when invalid default boot option provided This behaviour matches that of real GRUB. Signed-off-by: Michal Novotny --- tools/pygrub/src/pygrub | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub index e3a540fa04..ba70832e62 100644 --- a/tools/pygrub/src/pygrub +++ b/tools/pygrub/src/pygrub @@ -530,7 +530,11 @@ def run_grub(file, entry, fs, arg): print "No kernel image selected!" sys.exit(1) - img = g.cf.images[sel] + try: + img = g.cf.images[sel] + except: + log.debug("PyGrub: Default selection is not valid, using first boot configuration...") + img = g.cf.images[0] grubcfg = { "kernel": None, "ramdisk": None, "args": None } -- 2.30.2